#ifndef SERIALWORKS_H
#define SERIALWORKS_H
#include <QThread>
#include <QSerialPortInfo>
#include <QSerialPort>

class Serialworks :public QThread
{
    Q_OBJECT
public:

    explicit Serialworks(QObject *parent=0);
    ~Serialworks();

    void run();
    bool  openCom(QString com,int bitrate,int parity=0);
    void   closeCom();
    void  writeCom(QString str);
    void  writeCom (char *p,int len);

signals:
    void  signal_show_recv_com_data(QByteArray bytes);
    void  signal_show_warning();

public slots:
    void slot_com_param(QString com,int bitrate,int parity);
private:
    int m_comFd;
    QSerialPort *m_port;
    int m_bitrate;
    int m_parity;
    QString m_comName;
};

#endif // SERIALWORKS_H
